//
//  NSString+ZHExtention.m
//  ZHCategory
//
//  Created by zhusanbao on 2021/1/11.
//

#import "NSString+ZHExtension.h"

@implementation NSString (ZHExtension)

- (NSMutableAttributedString *)toMstrWithFont:(UIFont *)font color:(UIColor *)color styles:(void (^)(NSMutableParagraphStyle * _Nonnull))styles{
    NSMutableDictionary *dic = NSMutableDictionary.dictionary;
    dic[NSFontAttributeName] = font;
    dic[NSForegroundColorAttributeName] = color;
    if (styles) {
        NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
        styles(style);
        dic[NSParagraphStyleAttributeName] = style;
    }
    NSMutableAttributedString *mStr = [[NSMutableAttributedString alloc] initWithString:self attributes:dic];
    return mStr;
}


@end
